package com.lejin.portal.controller;


import com.lejin.cms.entity.Content;
import com.lejin.item.entity.CourseOutline;
import com.lejin.portal.service.IPortalService;
import com.lejin.vo.CatCascadeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("portal")
public class PortalController {

    @Autowired
    private IPortalService portalService;

    //缓存首页广告数据
    @RequestMapping("findContentListByTpid/{tpId}")
    public List<Content> findContentListByTpid(@PathVariable String tpId) {
        return portalService.findContentListByTpid(tpId);
    }

    //缓存首页二级分类菜单
    @RequestMapping("findCatMenu")
    public List<CatCascadeVO> findCatMenu() {
        return portalService.findCatMenu();
    }

    //缓存首页分类菜单下的价格最低4个课程信息
    @RequestMapping("findCourseByPriceAsc/{catId}")
    public List<CourseOutline> findCourseByPriceAsc(@PathVariable String catId) {
        return portalService.findCourseByPriceAsc(catId);
    }


    //缓存首页热门课程信息
    @RequestMapping("findCourseByHitsDesc/{cat2Id}")
    public List<CourseOutline> findCourseByHitsDesc(@PathVariable String cat2Id) {
        return portalService.findCourseByHitsDesc(cat2Id);
    }

}
